<?php
/**
 * @author 段志岩
 * @date 2008.8.17
 * @summary 解析请求类.
 */

class Dispatcher{
	public function __construct()
	{}
	public function run()
	{
		$uri = $_SERVER['REQUEST_URI'];

		$start = strpos($uri, '?');
		$end = strpos($uri, '&');

		if($start === false)
		{
			Action::redirect("Index", "doView");
		}else{
			$start += 1;
		}

		if($end === false)
		{
			$action = substr($uri, $start, strlen($uri));
		}else{
			$action = substr($uri, $start, $end - $start);
		}

		$conf = explode('-', $action);

		Action::forward($conf[0], $conf[1]);
	}
};
?>
